package com.sky.mapper.admin;


import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.EmployeeDTO;
import com.sky.dto.EmployeePageQueryDTO;
import com.sky.dto.PasswordEditDTO;
import com.sky.enumeration.OperationType;
import com.sky.pojo.Employee;
import com.sky.result.PageResult;
import com.sky.result.Result;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EmployeeMapper {

    /**
     * 根据用户名查询员工
     * @param username
     * @return
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);

    /**
     * 新增员工
     * @param dto
     * @return
     */
    @AutoFill(OperationType.INSERT)
    void insertEmploy(@Param("dto") Employee dto);

    Page<Employee> selectPage(String name);

    Employee selectId(Integer id);

    int reviseInformation(Employee employeeDTO);
     @Update("update employee set status=#{status},update_time=#{updateTime}" +
             ",update_user=#{updateUser} where id=#{id}")
     @AutoFill(OperationType.UPDATE)
    int updateStatus(Employee build);

    int updatePassword(Employee employee);
}
